package com.one.consumer.reserve.ui.binder;

import android.support.annotation.NonNull;
import android.view.View;

import com.one.common.view.multitytype.adapter.BaseItemBinder;
import com.one.common.view.multitytype.adapter.BaseViewHolderMulti;
import com.one.consumer.R;
import com.one.consumer.reserve.model.item.AreaItem;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/30 10:30 PM
 * description ：
 **/
public class QuestionBinder extends BaseItemBinder<AreaItem> {
    public QuestionBinder(AreaClickListener listener) {
        super(R.layout.item_question);
        this.listener = listener;
    }

    @Override
    protected void bindView(@NonNull BaseViewHolderMulti holder, @NonNull AreaItem item) {
        holder.setText(R.id.tv_question, item.getParts_name());
        holder.getView(R.id.tv_question).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(listener !=null){
                    listener.onAreaClick(item);
                }
            }
        });
    }


    private AreaClickListener listener;

    public interface AreaClickListener{
        void onAreaClick(AreaItem item);
    }


}
